using System;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;

namespace CodePlex.DnD4eCampaignManager.DnD4e
{
    public class Powers : IPowers, IEquatable<Powers>
    {
        public string PowersAtWill { get; set; }
        public string PowersDaily { get; set; }
        public string PowersEncounter { get; set; }

        public override bool Equals(object obj)
        {
            if ( ReferenceEquals(null, obj) )
            {
                return false;
            }
            if ( ReferenceEquals(this, obj) )
            {
                return true;
            }
            if ( obj.GetType() != typeof ( Powers ) )
            {
                return false;
            }
            return Equals((Powers) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = ( PowersAtWill != null ? PowersAtWill.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( PowersDaily != null ? PowersDaily.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( PowersEncounter != null ? PowersEncounter.GetHashCode() : 0 );
                return result;
            }
        }

        public bool Equals(Powers other)
        {
            if ( ReferenceEquals(null, other) )
            {
                return false;
            }
            if ( ReferenceEquals(this, other) )
            {
                return true;
            }
            return Equals(other.PowersAtWill, PowersAtWill) && Equals(other.PowersDaily, PowersDaily) &&
                   Equals(other.PowersEncounter, PowersEncounter);
        }

        public static bool operator ==(Powers left, Powers right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(Powers left, Powers right)
        {
            return !Equals(left, right);
        }
    }
}